package com.example.backspring.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.backspring.entity.Learn;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface LearnMapper extends BaseMapper<Learn> {
    @Insert("insert into learn (id,sj,nr,pod) values (#{id},#{sj},#{nr},#{pod})")
    int addnr(int id, String sj, String nr, int pod);

    @Update("update learn set pod =1 where id=#{id}")
    int gaiStatus(int id);

    @Select("select * from learn  ORDER BY sj  DESC ")
    List<Learn> getnr();

    @Select("select nr from learn  where sj like CONCAT('%',#{sj},'%') ")
    String getUpdatenr(String sj);

    @Update("update learn set nr=#{nr} where id= #{id}")
    int updatenr(int id, String nr);

    @Select("select id from learn where sj like CONCAT('%',#{sj},'%')")
    Integer huoId(String sj);
}
